package com.ruoyi.module.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.module.mapper.UserReviewRecordMapper;
import com.ruoyi.module.domain.UserReviewRecord;
import com.ruoyi.module.service.IUserReviewRecordService;
import com.ruoyi.common.utils.SecurityUtils;

/**
 * 用户复习记录Service业务层处理
 * 
 * @author ruoyi
 */
@Service
public class UserReviewRecordServiceImpl implements IUserReviewRecordService 
{
    @Autowired
    private UserReviewRecordMapper userReviewRecordMapper;

    /**
     * 查询用户复习记录
     */
    @Override
    public UserReviewRecord selectUserReviewRecordById(Long id)
    {
        return userReviewRecordMapper.selectUserReviewRecordById(id);
    }

    /**
     * 查询用户复习记录列表
     */
    @Override
    public List<UserReviewRecord> selectUserReviewRecordList(UserReviewRecord userReviewRecord)
    {
        if (userReviewRecord.getUserId() == null) {
            userReviewRecord.setUserId(SecurityUtils.getUserId());
        }
        return userReviewRecordMapper.selectUserReviewRecordList(userReviewRecord);
    }

    /**
     * 新增用户复习记录
     */
    @Override
    public int insertUserReviewRecord(UserReviewRecord userReviewRecord)
    {
        if (userReviewRecord.getUserId() == null) {
            userReviewRecord.setUserId(SecurityUtils.getUserId());
        }
        return userReviewRecordMapper.insertUserReviewRecord(userReviewRecord);
    }

    /**
     * 修改用户复习记录
     */
    @Override
    public int updateUserReviewRecord(UserReviewRecord userReviewRecord)
    {
        return userReviewRecordMapper.updateUserReviewRecord(userReviewRecord);
    }

    /**
     * 批量删除用户复习记录
     */
    @Override
    public int deleteUserReviewRecordByIds(Long[] ids)
    {
        return userReviewRecordMapper.deleteUserReviewRecordByIds(ids);
    }

    /**
     * 删除用户复习记录信息
     */
    @Override
    public int deleteUserReviewRecordById(Long id)
    {
        return userReviewRecordMapper.deleteUserReviewRecordById(id);
    }
}

